<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录|注册</title>
    <link rel="stylesheet" th:href="@{/mobile/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/mobile/css/style.css}">
    <script th:fragment="js" th:src="@{/mobile/js/jquery-1.9.1.js}"></script>
    <script th:fragment="js" th:src="@{/mobile/js/common.js}"></script>
    <script th:fragment="js" th:src="@{/mobile/layui/layui.all.js}"></script>
    <style type="text/css">
        .app {
            display: none;
        }

        @media (max-width: 500px) {
            .app {
                display: block !important;
            }
        }

        .pc {
            display: block;
        }

        @media (max-width: 500px) {
            .pc {
                display: none;
            }
        }
    </style>
<!--    <div th:include="common/css :: css"></div>-->



</head>
<body id="read" >

</div>

<div style="height: 50px;line-height: 50px;text-align: center" class="layui-header header header-doc  layui-bg-cyan">

    <div style="float: left;margin-left: 10px">
        <a href="javascript:history.go(-1)">
            <i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
    </div>
    <b class="layui-icon">登录|注册</b>
    <div style="float: right;margin-right: 10px"><a th:href="@{/}">
        <i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i>
    </a>
    </div>
</div>

    <input type="hidden" id="bookIdHidden" name="bookId" th:value="${bookId}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">登录名</label>
        <div class="layui-input-block">
            <input type="text" id="username" name="username" required  lay-verify="required" placeholder="请输入登录名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input id="password" type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">如果登录名不存在，则直接注册！</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn login-button" lay-submit lay-filter="formDemo">登录|注册</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>


<!--<div th:replace="common/footer :: footer">-->
</div>

<a name="buttom"></a>
</body>
<!--<div th:replace="common/js :: js"></div>-->
<script type="text/javascript" th:src="@{/js/prompt.js}"></script>
<script type="text/javascript" th:inline="javaScript">

    let webPath=/*[[@{/}]]*/''
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        $(".login-button").click(function () {
            let username = $("#username").val();
            let password = $("#password").val();
            $.ajax({
                url: webPath + "/loginV",
                type: "POST",
                data: {"username": username,"password":password},
                dataType: 'json',
                success: function (res) {
                    if (res.status===200){
                        layer.msg(res.msg, {icon: 6});
                        window.location.href = webPath + "/index";
                    }else {
                        layer.msg(res.msg, {icon: 5,anim: 6});
                    }
                }
            });
            return false;
        })
    });
</script>
<script>



    function toMyCollect(){
        var token = localStorage.getItem("token");
        if(token) {
            window.location.href = "/book/search?token=" + token;
        }else{
            window.location.href = "/user/login.html";
        }
    }
</script>


</html>